EMT Practice Test

1. Question Content...


Question List

Question1: What is the expected behavior of the following code?

Question2: What can you deduce from the following statement? (Select two answers)
str = open('file.txt', "rt")

Question3: What is the output of the following piece of code?

Question4: Assuming that the following code has been executed successfully, selected the expression which evaluate to True (Select two answers)

Question5: Python's built-in function named open () tries to open a file and returns:

Question6: What is the expected behavior of the following code?

Question7: Can a module run like regular code?

Question8: What is the expected behavior of the following code?

It will:

Question9: The following class hierarchy is given. What is the expected output of the code?

Question10: What is the expected behavior of the following code?

Question11: Which of the following snippets will execute without raising any unhandled exceptions? (Select answers) A)

B)

C)

D)

Question12: If you need to serve two different exceptions called Ex1 and Ex2 in one except branch, you can write:

Question13: Assuming that the code below has been placed inside a file named code.py and executed successfully, which of the following expressions evaluate to True? (Select two answers)

Question14: What is the expected output of the following snippet?

Question15: A method for passing the arguments used by the following snippet is called:

Question16: What is the expected behavior of the following code?

Question17: What is the expected behavior of the following code?

It will:

Question18: Which of the following statements are true? (Select two answers)

Question19: What is the expected behavior of the following snippet?

It will:

Question20: A Python module named pymod, py contains a function named pyfun ( ).
Which of the following snippets will let you invoke the function? (Select two answers)

Question21: Assuming that the code below has been placed inside a file named code.py and executed successfully which of the following expressions evaluate to True? (Select two answers)

Question22: Which of the following invocations are valid? (Select two answers)

Question23: Select the valid fun () invocations:
(select two answers)
def fun (a, b=0):
return a*b

Question24: Which of the following statements are true? (Select two answers)

Question25: What is the expected out of the following code of the file named zero_length_existing_file is a zero-length file located inside the working directory?

Question26: Assuming that String is six or more letters long, the following slice
String[1:-2]
is shorter than the original string by:

Question27: What is the expected behavior of the following code?

Question28: Assuming that the code below has been executed successfully, which of the following expressions will always evaluate to True? (Select two answers) import random v1 = random. random() v2 = random. random()

Question29: What is true about Object-Oriented Programming in Python? (Select two answers)

Question30: There is a stream named s open for writing. What option will you select to write a line to the stream''

Question31: Python strings can be "glued" together using the operator:

Question32: What is the expected behavior of the following code?

Question33: How many lines does the following snippet output?

Question34: With regards to the directory structure below, select the proper forms of the directives in order to import module_ a. (Select two answers)

Question35: What is the expected behavior of the following code?

Question36: The simplest possible class definition in Python can be expressed as:

Question37: The__bases__property contains:

Question38: A file name like this one below says mat: (select three answers)
services. cpython-36.pyc

Question39: Assuming that the following code has been executed successfully, select the expressions which evaluate to True (Select two answers)

Question40: Assuming that the snippet below has been executed successfully, which of the following expressions will evaluate to True? (Select two answers) string = 'SKY' (:: -1) string = string (-1)

Question41: Which of the following statements are true? (Select two answers)

Question42: What is the expected output of the following snippet?

Question43: What is true about Object-Oriented Programming in Python? (Select two answers)

Question44: Which of the following lambda definitions are correct? (Select two answers)

Question45: Is it possible to safely check if a class/object has a certain attribute?

Question46: With regards to the directory structure below, select the proper forms of the directives in order to import module_c. (Select two answers)

Question47: You are going to read 16 bytes from a binary file into a bytearray called dat a. Which lines would you use? (Select two answers)

Question48: What is true about Python packages? (Select two answers)

Question49: What can you do if you don't like a long package path tike this one0 import alpha.beta.gamma.delta.epsiIon.zeta